home *** CD-ROM | disk | FTP | other *** search
- /* Using the if statement with numerical data. */
- using System;
-
- namespace Chapter2 {
- class Class1 {
- static void Main() {
- int iAnswer;
-
- // Step 1
- Console.Write("1 + 1 = ");
-
- // Step 2
- iAnswer = int.Parse(Console.ReadLine());
-
- // Step 3 û numbers do not require quotes
- if (iAnswer == 2)
- Console.WriteLine("\n That is correct!\n");
-
- // Step 4
- if (iAnswer != 2)
- Console.WriteLine("\n Wrong!!!\n");
- }
- }
- }
-
-